#ifndef PLAYGAMESENCE_H
#define PLAYGAMESENCE_H

#include <QWidget>
#include <QKeyEvent>
#include <QTimer>

#include "player.h"

class PlayGameSence : public QWidget
{
    Q_OBJECT
public:
    explicit PlayGameSence(QWidget *parent = nullptr, int frame_size = -1, int window_width = -1, int window_height = -1, int block_size = -1, int player_num = -1);
    void paintEvent(QPaintEvent* event) override;
    void keyReleaseEvent(QKeyEvent *event) override;
    void keyPressEvent(QKeyEvent *event) override;
    void setPlayerNum(int player_num);

    void updatePosition();

signals:
    void exitGame();

private:
    std::vector<std::vector<QColor>> block_color;
    int f_size;
    int w_width, w_height;
    int block_size;
    int player_num;

    std::vector<Player> players;

    QTimer* timer;
};

#endif // PLAYGAMESENCE_H
